<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5shiv.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<![endif]-->
<link rel="stylesheet" type="text/css" href="/static/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="/static/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="/static/lib/Hui-iconfont/1.0.8/iconfont.css" />
<link rel="stylesheet" type="text/css" href="/static/h-ui.admin/skin/default/skin.css" id="skin" />
<link rel="stylesheet" type="text/css" href="/static/h-ui.admin/css/style.css" />
<style type="text/css">
	.btns{border:solid 1px #44ABF7;color:#44ABF7;padding:4px 12px;text-decoration:none !important;}
	.btn-primarys{border-color:#44ABF7;background-color:#44ABF7;color:#fff;}
	.btns:hover{color:#fff;background-color:#44ABF7;}
	ul{width:100%;height:31px;}
	ul li{float:left;margin-right:3px;}
	hr{margin-top:20px;margin-bottom:10px;border:0;border-top:1px solid #eee;}
	dl input{margin-top:10px;}
	.input-text[type="number"]{width:140px;}
</style>
<!--[if IE 6]>
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>添加导航 - H-ui.admin v3.1</title>
<meta name="keywords" content="H-ui.admin v3.1,H-ui网站后台模版,后台模版下载,后台管理系统模版,HTML后台模版下载">
<meta name="description" content="H-ui.admin v3.1，是一款由国人开发的轻量级扁平化网站后台模板，完全免费开源的网站后台管理系统模版，适合中小型CMS后台系统。">
</head>
<body>
<article class="page-container">
	<form class="form form-horizontal" id="form-admin-add">
		<div class="row cl">
			<label class="form-label col-xs-3 col-sm-2">导航类型：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<span class="select-box" style="width:150px;">
					<select name="nav_type" id="nav_type" class="select">
					  {volist name="nav_type" id="vo" key="k"}
					  	<option value="{$k}">&nbsp;{$vo}&nbsp;</option>
					  {/volist}
					</select>
				</span>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-3 col-sm-2">名称：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="" placeholder="名称" id="nav_name" name="nav_name">
				<p style="font-size:12px;color:#ccc;">导航栏名称不要设置太长，小程序最好设置2个字左右，PC端最好设置在4个字左右</p>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-3 col-sm-2">链接类型：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<ul>
					<li><a class="btns btn-primarys radius">普通</a></li>
					<li><a class="btns radius">单页</a></li>
					<li><a class="btns radius">跳转小程序</a></li>
					<li><a class="btns radius">跳转链接</a></li>
					<li><a class="btns radius">一键联系人</a></li>
				</ul>
				<input type="hidden" class="input-text" value="0" placeholder="链接类型" id="link_style" name="link_style">
				<dl>
					<dd>
						<span class="select-box" style="width:300px;margin-top:10px;">
							<select name="nav_link" id="wx_pl" class="select">
							  {foreach $wx_pl as $key=>$vo }
							  	<option value="{$vo.url}">&nbsp;{$vo.title}--{$vo.url}&nbsp;</option>
							  {/foreach}
							</select>
							<select name="nav_link" id="web_pl" class="select">
							  {foreach $web_pl as $key=>$vo}
							  	<option value="{$vo.url}">&nbsp;{$vo.title}--{$vo.url}&nbsp;</option>
							  {/foreach}
							</select>
						</span>
					</dd>
					<dd>
						<input type="number" class="input-text" placeholder="请填写单页列表ID" name="single" value="">
					</dd>
					<dd>
						<input type="text" class="input-text" name="wxappid" placeholder="请填写微信appid" value="">
						<input type="text" class="input-text" name="wxpage" placeholder="请填写微信小程序的页面，例:pages/index/index" value="">
						<hr>
						<input type="text" class="input-text" name="bdappid" placeholder="请填写百度appid" value="">
						<input type="text" class="input-text" name="bdpage" placeholder="请填写百度小程序的页面，例:pages/index/index" value="">
						<hr>
						<input type="text" class="input-text" name="zjappid" placeholder="请填写字节跳动appid" value="">
						<input type="text" class="input-text" name="zjpage" placeholder="请填写字节跳动小程序的页面，例:pages/index/index" value="">
					</dd>
					<dd>
						<input type="text" class="input-text" name="webpage" placeholder="请填写网页链接，例:https://www.baidu.com" value="">
					</dd>
					<dd>
						<input type="text" class="input-text" name="telphone" placeholder="请填写联系号码" value="">
					</dd>
				</dl>
			</div>
		</div>
		<!-- <div class="row cl">
			<label class="form-label col-xs-3 col-sm-2">链接地址：</label>
			<div class="formControls col-xs-8 col-sm-9">
			</div>
		</div> -->
		<div class="row cl">
			<label class="form-label col-xs-3 col-sm-2">图标：</label>
			<div class="formControls col-xs-8 col-sm-9">
                <div style="position:relative;" id="drop_area"></div>
                <p style="color:#ccc;font-size:12px;">建议尺寸宽高:1:1</p>
			</div>
		</div>
		<div class="row cl" id="imgt">
			<label class="form-label col-xs-3 col-sm-2">选中图标：</label>
			<div class="formControls col-xs-8 col-sm-9">
                <div style="position:relative;" id="drop_areao"></div>
                <p style="color:#ccc;font-size:12px;">建议尺寸宽高:1:1</p>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-3 col-sm-2">排序：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="number" class="input-text" value="" placeholder="0" id="sort" name="sort">
			</div>
		</div>
		<div class="row cl">
			<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
				<input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
			</div>
		</div>
	</form>
</article>

<!--_footer 作为公共模版分离出去--> 
<script type="text/javascript" src="/static/lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="/static/lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="/static/h-ui/js/H-ui.min.js"></script> 
<script type="text/javascript" src="/static/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="/static/lib/jquery.validation/1.14.0/jquery.validate.js"></script> 
<script type="text/javascript" src="/static/lib/jquery.validation/1.14.0/validate-methods.js"></script> 
<script type="text/javascript" src="/static/lib/jquery.validation/1.14.0/messages_zh.js"></script> 
<script type="text/javascript" src="/static/js/upload.js"></script>
<script type="text/javascript">
var imgpz;
var imgpzo;
$(function(){
  $("#nav_type").change(function(){
    var typeid= $(this).val();
    if(typeid==3){
    	$("#web_pl").css('display','block');
    	$("#wx_pl").css('display','none');
        $("#web_pl").removeAttr('disabled');
        $("#wx_pl").attr('disabled','true');
		$("#imgt").css('display','none');
		$("ul li:nth-child(3)").css('display','none');
		$("ul li:nth-child(5)").css('display','none');
    }else if(typeid==2){
    	$("#wx_pl").css('display','block');
    	$("#web_pl").css('display','none');
        $("#wx_pl").removeAttr('disabled');
        $("#web_pl").attr('disabled','true');
		$("#imgt").css('display','block');
		$("ul li:nth-child(3)").css('display','block');
		$("ul li:nth-child(5)").css('display','block');
	}else if(typeid==1){
    	$("#wx_pl").css('display','block');
    	$("#web_pl").css('display','none');
        $("#wx_pl").removeAttr('disabled');
        $("#web_pl").attr('disabled','true');
		$("#imgt").css('display','none');
		$("ul li:nth-child(3)").css('display','block');
		$("ul li:nth-child(5)").css('display','block');
	}
  });
  $("li").click(function(){
  	var tmdn=$(this).index()+1;
  	$("#link_style").val($(this).index());
  	$("dl dd").css('display','none');
  	$("dl dd:nth-child("+tmdn+")").css('display','block');
  	$(this).children().addClass("btn-primarys");
  	$(this).siblings().children().removeClass("btn-primarys");
  });
});
$(function(){
	$("#wx_pl").css('display','block');
	$("#web_pl").css('display','none');
    $("#web_pl").attr('disabled','true');
	$("#imgt").css('display','none');
  	$("dl dd").css('display','none');
  	$("dl dd:nth-child(1)").css('display','block');
	$('.skin-minimal input').iCheck({
		checkboxClass: 'icheckbox-blue',
		radioClass: 'iradio-blue',
		increaseArea: '20%'
	});
	
	$("#form-admin-add").validate({
		rules:{
		},
		onkeyup:false,
		focusCleanup:true,
		success:"valid",
		submitHandler:function(form){
			$(form).ajaxSubmit({
				type: 'post',
				url: "{:url('nav_add')}",
				data:{nav_ico:imgpz,imgt:imgpzo},
				success: function(data){
					if(data.code==200){
						// var index = parent.layer.getFrameIndex(window.name);
						parent.location.reload();
						// parent.layer.close(index);
					}else{
						layer.msg(data.msg,{icon:2,time:3000});
					}

				},
                error: function(XmlHttpRequest, textStatus, errorThrown){
					var index = parent.layer.getFrameIndex(window.name);
					parent.layer.close(index);
				}
			});
		}
	});
});
var dragImgUpload = new DragImgUpload("#drop_area",{
    callback:function (files) {
        //回调函数，可以传递给后台等等
        if(files[0].size<3145728){
	        var file = files[0];
	        var formData = new FormData();
	        formData.append("file",file);
	        $.ajax({
	              type: 'POST',
	              url: "{:url('qiniuupload')}",
	              data:formData,
	              contentType: false, /*不可缺*/
	              processData: false, /*不可缺*/
	              success: function(response){
	                if(response.code==200){
	                  imgpz=response.data
	                }else{
	                  alert(response.msg);
	                }
	              },
	              error: function(err){

	              }
	        })
        }else{
        	alert('出错');
        	location.replace(location.href);
        }
    }
});
var dragImgUploado = new DragImgUpload("#drop_areao",{
    callback:function (files) {
        //回调函数，可以传递给后台等等
        if(files[0].size<3145728){
	        var file = files[0];
	        var formData = new FormData();
	        formData.append("file",file);
	        $.ajax({
	              type: 'POST',
	              url: "{:url('qiniuupload')}",
	              data:formData,
	              contentType: false, /*不可缺*/
	              processData: false, /*不可缺*/
	              success: function(response){
	                if(response.code==200){
	                  imgpzo=response.data
	                }else{
	                  alert(response.msg);
	                }
	              },
	              error: function(err){

	              }
	        })
        }else{
        	alert('出错');
        	location.replace(location.href);
        }
    }
});
</script> 
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>